<template>
  <div>
    <van-nav-bar title="首页" />
    <van-search v-model="value" shape="round" background="#4fc08d" placeholder="请输入搜索关键词" @click="button" />
    <van-swipe :autoplay="3000" lazy-render>
      <van-swipe-item v-for="image in images" :key="image">
        <img :src="image" style="width: 100%;height: 200px;" />
      </van-swipe-item>
    </van-swipe>
    <van-grid :column-num="4">
      <van-grid-item v-for="item in wch" :icon="item.image_src" :text="item.name" />
    </van-grid>
    <div v-for="item in wch1">
      <img :src="item.floor_title.image_src" alt="" style="width: 200px;height: 40px;">
      <div v-for="items in item.product_list">
        <img :src="items.image_src
          " alt="" style="width: 100px;">
      </div>
    </div>
  </div>
</template>

<script setup>
import { catitemsApi, floordataApi } from '@/api/api'
import { ref } from 'vue'
import router from '@/router'
let wch = ref([])
let wch1 = ref([])

const images = [
  'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
  'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
  'https://fastly.jsdelivr.net/npm/@vant/assets/apple-3.jpeg',
  'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
];
catitemsApi().then(res => {
  console.log('导航', res)
  wch.value = res.data.message
})
floordataApi().then(res => {
  console.log('楼层', res)
  wch1.value = res.data.message
})
const button=()=>{
  router.push('/ss')
}
</script>

<style lang="scss" scoped></style>